﻿using GoGameClient.script.entity;

namespace GoGameClient.script.global;

public class UserControl
{
    private long UserId { get; set; }
    private RoleEntity Role { get; set; }
    private static UserControl _userControl;

    public static UserControl GetInstance()
    {
        return _userControl ??= new UserControl();
    }

    public void SetUserId(long userId)
    {
        UserId = userId;
    }

    public long GetUserId()
    {
        return UserId;
    }

    public void SetRole(RoleRes role)
    {
        Role = new RoleEntity
        {
            Id = role.Id,
            RoleName = role.RoleName,
            Model = role.Model,
            Sect = role.Sect,
            Sex = role.Sex,
            Race = role.Race,
            Popularity = role.Popularity,
            MapId = role.MapId,
            VariantX = role.VariantX,
            VariantY = role.VariantY,
            Imprest = role.Imprest,
            Deposit = role.Deposit,
            Level = role.Level,
            MaxExp = role.MaxExp,
            Exp = role.Exp,
            Gold = role.Gold,
            Vitality = role.Vitality,
            PhysicalStrength = role.PhysicalStrength,
            Hp = role.Hp,
            MaxHp = role.MaxHp,
            Blood = role.Blood,
            Mp = role.Mp,
            MaxMp = role.MaxMp,
            Anger = role.Anger
        };
    }

    public RoleEntity GetRole()
    {
        return Role;
    }
}